package com.laborder.sysyy.service.annoncement.impl;

import com.laborder.sysyy.dao.AnnounceDaoMapper;
import com.laborder.sysyy.entity.Announce;
import com.laborder.sysyy.service.annoncement.AnnounceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * @author 786107529@qq.com FJL
 * @Date 2018/9/8 17:51
 */
@Service
public class AnnounceServiceImpl implements AnnounceService {
    @Autowired
    private AnnounceDaoMapper announceDaoMapper;
@Override
    public List<Announce> findAnnounceWithPage(Map<String,Object> map){
        return announceDaoMapper.findAnnounceWithPage(map);
    }
    @Override
    public  int getAnnounceCount(Map<String,Object> map) {
        return announceDaoMapper.getAnnounceCount(map);
    }

    @Override
    public  int saveAnnounceInfo(Announce announce) {
        return announceDaoMapper.saveAnnounceInfo(announce);
    }

    @Override
    public  boolean updateAnnounceInfo(Announce announce) {
        if(announceDaoMapper.updateAnnounceInfo(announce)!=0)
            return true;
        return false;
    }

    @Override
    public boolean delAnnounceInfo(int aId) {
        if(announceDaoMapper.delAnnounceInfo(aId)!=0)
            return true;
        return false;
    }

    @Override
    public Announce getAnnounceByIdInfo(int aId) {
        return announceDaoMapper.getAnnounceByIdInfo(aId);
    }

    /**
     * @function: 根据名称和内容查重
     * @author: 759057893@qq.com lyz
     * @date: 2019/1/16 14:57
     */
    @Override
    public Announce getAnnounceInfoByName(String aName, String aDesc) {
        return announceDaoMapper.getAnnounceInfoByName(aName,aDesc);
    }
}
